package com.jvm.JIT;

/**
 * JITOptimizationDemo..
 *
 * @author Lizhong
 * @date 2019/3/23
 */
public class JITOptimizationDemo {
    /**
     * VM: -XX:+PrintCompilation
     * 打印出JIT 编译器优化 %
     * @param args
     */
    public static void main(String[] args) {
        JITOptimizationDemo jitOptimizationDemo = new JITOptimizationDemo();
        for (int i = 0; i < 1000; i++) {
            jitOptimizationDemo.method01();
        }
    }

    public int loope(int i) {
        for (int j=0; j < 10000; j++) ;
        return i * 2;
    }

    public int method01() {
        int s = 0;
        for (int i = 1; i < 1000; i++) {
            s += loope(i);
        }
        return s;
    }

}


